package com.demo.java.layer.service.impl;

import com.demo.java.layer.dao.GroupRepository;
import com.demo.java.layer.model.entity.Group;
import com.demo.java.layer.service.AbstractService;
import com.demo.java.layer.service.GroupService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Slf4j
@Service
@Transactional(readOnly = true)
public class GroupServiceImpl extends AbstractService<Group, Long, GroupRepository> implements GroupService {

    private final GroupRepository groupRepository;

    @Autowired
    protected GroupServiceImpl(GroupRepository repository) {
        super(repository);
        this.groupRepository = repository;
    }

    @Override
    @Transactional(propagation = Propagation.NEVER)
    public List<Group> findList() {
        return groupRepository.findAll();
    }
}
